<?php
class Listas_Form_Diligenciar extends Form_Cna {
	
    protected $elementosSeccion;
    protected $gradosEscala;
		
	public function __construct($options = null) {
		parent::__construct($options);
	}
	
	public function setElementosSeccion($elementosSeccion) {
		$this->elementosSeccion = $elementosSeccion;
	}
	public function setGradosEscala($gradosEscala) {
		$this->gradosEscala = $gradosEscala;
	}
	
	public function init() {
		$this->setName('diligenciar');
		$this->setMethod("post");
		
		$elements[] = new Zend_Form_Element_Hidden("codseccionlista");
		$elements[] = new Zend_Form_Element_Hidden("opcion");

		foreach ($this->elementosSeccion as $key =>$elemento){
		    
		    $element = new Zend_Form_Element_Radio("codescala_{$elemento["codtramiteelemento"]}");
		    $element->setLabel($elemento["nombre"]);
		    $element->addMultiOptions($this->gradosEscala);
			$elements[] = $element;
			
	        $element = new Zend_Form_Element_Textarea("justificacionvaloracion_{$elemento["codtramiteelemento"]}");
			$element->addFilter('StripTags');
			$element->addFilter('StringTrim');
			$element->setAttrib("rows",3);
			$element->setAttrib("cols",70);
			$elements[] = $element;
		}
       
		$element = new Zend_Form_Element_Submit('btnSubmit');
		$element->setLabel('Guardar');
		$element->setValue('Guardar');
		$element->setAttrib("class", "iceCmdBtn");
		$elements[] = $element;
		
		$this->addElements ($elements);
		
	    $this->loadViewScriptDecorators();
//		$this->loadTableDecorators();
	}
	
	public function loadViewScriptDecorators() {
		$this->setDecorators ( array (array ('viewScript', array ('viewScript' => 'viewscripts/diligenciar_form.phtml' ) ) ) );
	}
	
}
